home *** CD-ROM | disk | FTP | other *** search
- #include "Private.h"
-
- #define FF_DRAWBORDER_UP (1L << 0)
- #define FF_DRAWBORDER_DOWN (1L << 1)
- #define FF_DRAWBORDER_SEPARE (1L << 2)
- #define FF_DRAWBORDER_SIZEGAD (1L << 3)
-
- ///Shade_DrawBorder
- void Shade_DrawBorder(struct FeelinClass *Class,FObject Obj,struct RastPort *rp,ULONG *pn,ULONG Flags)
- {
- struct LocalObjectData *LOD = F_LOD(Class,Obj);
-
- WORD x1 = _x, x2 = _x2, ix1 = _mx - 1, ix2 = _mx2 + 1,
- y1 = _y, y2 = _y2, iy1 = _my - 1, iy2 = _my2 + 1;
-
-
- if (FF_DRAWBORDER_UP & Flags)
- {
- _APen(pn[FV_Pen_Dark]);
- _Line(x1,iy1,x1,y1); _Draw(x2,y1); _Draw(x2,iy1);
- _Line(ix1,iy1,ix2,iy1);
-
- _APen(pn[FV_Pen_Shine]);
- _Line(x1+1,iy1,x1+1,y1+1); _Draw(x2-2,y1+1); _Plot(ix2+1,iy1);
-
- _APen(pn[FV_Pen_Shadow]);
- _Line(ix1,iy1-1,ix2,iy1-1); _Plot(ix1-1,iy1); _Plot(ix1-1,iy1-1);
- _Line(x2-1,y1+2,x2-1,iy1);
-
- _APen(pn[FV_Pen_Fill]);
- _Boxf(x1+2,y1+2,ix1-2,iy1);
- _Boxf(ix2+2,y1+2,x2-2,iy1); _Plot(ix2+1,iy1-1); _Plot(x2-1,y1+1);
- _Boxf(ix1-1,y1+2,ix2+1,iy1-2);
- }
-
- if (FF_DRAWBORDER_DOWN & Flags)
- {
- _APen(pn[FV_Pen_Dark]);
- _Line(x1,iy1+1,x1,y2); _Draw(x2,y2); _Draw(x2,iy1+1);
- _Line(ix1,iy1+1,ix1,iy2); _Draw(ix2,iy2); _Draw(ix2,iy1+1);
-
- _APen(pn[FV_Pen_Shine]);
- _Line(x1+1,iy1+1, x1+1,y2-2);
- _Line(ix1,iy2+1, ix2+1,iy2+1); _Draw(ix2+1,iy1+1);
-
- _APen(pn[FV_Pen_Shadow]);
- _Line(ix1-1,iy1+1,ix1-1,iy2);
- _Line(x1+2,y2-1,x2-1,y2-1); _Draw(x2-1,iy1+1);
-
- _APen(pn[FV_Pen_Fill]);
- _Plot(x1+1,y2-1); _Plot(ix1-1,iy2+1);
- _Boxf(x1+2,iy1+1, ix1-2,iy2+1);
- _Boxf(x1+2,iy2+2, x2-2,y2-2);
- _Boxf(ix2+2,iy1+1, x2-2,iy2+1);
- }
-
- if (FF_DRAWBORDER_SEPARE & Flags)
- {
- _APen(pn[FV_Pen_Shine]);
- _Line(x1+2,iy1+1,ix1-2,iy1+1);
- _Line(ix2+2,iy1+1,x2-2,iy1+1);
- _APen(pn[FV_Pen_Fill]);
- _Plot(ix1-1,iy1+1); _Plot(x2-1,iy1+1);
- }
-
- if (FF_DRAWBORDER_SIZEGAD & Flags)
- {
- WORD x = x2 - SIZE + 1,
- y = y2 - SIZE + 1;
-
- _APen(pn[FV_Pen_Dark]); _Line(x,iy2+1, x,y2); _Line(ix2+1,y, x2,y);
- _APen(pn[FV_Pen_Shine]); _Line(ix2+1,y+1, x2-1,y+1); _Line(x+1,y2-1, x+1,iy2+1);
- _APen(pn[FV_Pen_Shadow]); _Line(x-1,iy2+2, x-1,y2-1); _Line(ix2+2,y-1, x2-1,y-1);
- _APen(pn[FV_Pen_Fill]); _Plot(x-1,iy2+1); _Plot(x+1,y2-1); _Plot(x2-1,y+1); _Plot(ix2+1,y-1);
- }
- }
- //+
-
- ///Shade_DrawActive
- SAVEDS void Shade_DrawActive(struct FeelinClass *Class,APTR Obj,ULONG Flags)
- {
- struct LocalObjectData *LOD = F_LOD(Class,Obj);
- struct RastPort *rp = _rp;
- ULONG *pn = LOD -> AScheme -> Pens;
- WORD x1 = _x, x2 = _x2, ix1 = _mx - 1, ix2 = _mx2 + 1,
- y1 = _y, /*y2 = _y2,*/ iy1 = _my - 1/*, iy2 = _my2 + 1*/;
-
- ULONG simple_flags = FF_DRAWBORDER_DOWN;
-
- if (LOD -> LastDrawn == FV_Shade_LastDrawn_Active) return;
-
- _render -> Palette = LOD -> AScheme;
-
- if (LOD -> Gad_Dragbar)
- {
- FObject gad;
- FAreaData *gad_ad = (FAreaData *)((ULONG)(LOD -> Gad_Dragbar) + FC_Area_Offset);
-
- WORD dx1 = gad_ad -> Box.x - 1,
- dx2 = dx1 + gad_ad -> Box.w + 1;
-
- struct FeelinRender *renderbuf=NULL;
-
- if (FF_SHADE_BUFFER & LOD -> Flags)
- {
- if (x1 == 0 && y1 == 0)
- {
- if (renderbuf = CreateRenderBuffer(x2 - x1 + 1,iy1 + 1,_render))
- {
- rp = renderbuf -> RPort;
- }
- }
- }
-
- _APen(pn[FV_Pen_Dark]);
- _Line( x1,iy1, x1, y1); _Draw(x2,y1) ; _Draw(x2,iy1);
- _Line(ix1,iy1, ix2,iy1);
- _Line(dx1,y1+1,dx1,iy1-1);
- _Line(dx2,y1+1,dx2,iy1-1);
-
- _APen(pn[FV_Pen_Shine]);
- _Line(x1+1,iy1,x1+1,y1+1); _Draw(dx1-2,y1+1);
- _Line(dx2+1,iy1,dx2+1,y1+1); _Draw(x2-2,y1+1);
-
- _APen(pn[FV_Pen_Shadow]);
- _Line(dx1-1,iy1,dx1-1,y1+2);
- _Line(x2-1,iy1,x2-1,y1+2);
-
- _APen(pn[FV_Pen_Fill]);
- _Line(x1+2,iy1,ix1-2,iy1);
- _Line(ix2+2,iy1,x2-2,iy1);
- _Boxf(x1+2,y1+2,dx1-2,iy1-1); _Plot(dx1-1,y1+1);
- _Boxf(dx2+2,y1+2,x2-2,iy1-1); _Plot(x2-1,y1+1);
-
- if (LOD -> Gad_Close || LOD -> Gad_Iconify)
- {
- _APen(pn[FV_Pen_Dark]); _Plot(dx1-1,iy1);
- _APen(pn[FV_Pen_Shadow]); _Plot(ix1-1,iy1); _Line(ix1-1,iy1-1,dx1-1,iy1-1);
- }
-
- if (LOD -> Gad_Zoom || LOD -> Gad_Depth)
- {
- _APen(pn[FV_Pen_Dark]); _Plot(dx2+1,iy1);
- _APen(pn[FV_Pen_Shadow]); _Line(dx2+2,iy1-1,ix2,iy1-1);
- _APen(pn[FV_Pen_Shine]); _Plot(ix2+1,iy1);
- _APen(pn[FV_Pen_Fill]); _Plot(dx2+1,iy1-1);
- }
-
- {
- gad = (FObject) F_Get(Obj,FA_Group_Head);
-
- while (gad)
- {
- // F_DebugOut(0,"%s{%08lx}.DrawActive() - Gad %s{%08lx} - Pens 0x%08lx (APens 0x%08lx)\n",_classname(Obj),Obj,_classname(gad),gad,_render(gad) -> Pens,LOD -> AScheme);
-
- gad_ad = (FAreaData *) F_Get(gad,FA_AreaData);
-
- if (renderbuf)
- {
- struct FeelinRender *orender = gad_ad -> Render;
-
- gad_ad -> Render = renderbuf;
-
- F_Draw(gad,FF_Draw_Object);
-
- gad_ad -> Render = orender;
- }
- else
- {
- F_Draw(gad,FF_Draw_Object);
- }
-
- gad = gad_ad -> Next;
- }
- }
-
- if (renderbuf)
- {
- ClipBlit(rp,0,0,_rp,x1,y1,x2 - x1 + 1,iy1 + 1,0x0C0);
- DeleteRenderBuffer(renderbuf);
- rp = _rp;
- }
- }
- else
- {
- simple_flags |= FF_DRAWBORDER_UP;
- }
-
- if (!F_Get(LOD -> Gad_Size,FA_Hidden))
- {
- simple_flags |= FF_DRAWBORDER_SIZEGAD;
- }
-
- Shade_DrawBorder(Class,Obj,rp,pn,simple_flags);
-
- LOD -> LastDrawn = FV_Shade_LastDrawn_Active;
- }
- //+
- ///Shade_DrawInactive
- SAVEDS void Shade_DrawInactive(struct FeelinClass *Class,APTR Obj,ULONG Flags)
- {
- struct LocalObjectData *LOD = F_LOD(Class,Obj);
- struct RastPort *rp = _rp;
- ULONG *pn = LOD -> IScheme -> Pens;
- WORD x1 = _x, x2 = _x2,
- y1 = _y, iy1 = _my - 1;
-
- ULONG simple_flags = FF_DRAWBORDER_DOWN;
-
- if (LOD -> LastDrawn == FV_Shade_LastDrawn_Inactive) return;
-
- _render -> Palette = LOD -> IScheme;
-
- if (LOD -> Gad_Dragbar)
- {
- struct FeelinRender *render_buf = NULL,
- *old_render = _render;
-
- FAreaData *gad_ad = (FAreaData *) F_Get(LOD -> Gad_Dragbar,FA_AreaData);
-
- if (FF_SHADE_BUFFER & LOD -> Flags)
- {
- if (x1 == 0 && y1 == 0)
- {
- if (render_buf = CreateRenderBuffer(x2 - x1 + 1,iy1 + 1,_render))
- {
- gad_ad -> Render = render_buf; rp = render_buf -> RPort;
- }
- }
- }
-
- _APen(pn[FV_Pen_Dark]);
- _Line(x1,iy1,x1,y1); _Draw(x2,y1); _Draw(x2,iy1); _Draw(x1,iy1);
-
- F_Draw(LOD -> Gad_Dragbar,FF_Draw_Object);
-
- if (render_buf)
- {
- gad_ad -> Render = old_render;
-
- ClipBlit(rp,0,0,_rp,0,0,x2 - x1 + 1,iy1 + 1,0x0C0);
- DeleteRenderBuffer(render_buf);
- rp = _rp;
- }
-
- simple_flags |= FF_DRAWBORDER_SEPARE;
- }
- else
- {
- simple_flags |= FF_DRAWBORDER_UP;
- }
-
- Shade_DrawBorder(Class,Obj,rp,pn,simple_flags);
-
- LOD -> LastDrawn = FV_Shade_LastDrawn_Inactive;
- }
- //+
-
-